#include "util.h"
#include "ServerEndpoint/ServerEndpoint.h"

using namespace std;

int main(int argc, char *argv[])
{
    Application::SetArgs(argc, argv);

    auto server = ServerEndpoint(Pistache::IP::any(), Pistache::Port(1234), 1);

    HandleFunc func = [](const Pistache::Rest::Request& request, Pistache::Http::ResponseWriter response)
    {
        response.send(Pistache::Http::Code::Not_Acceptable, "<!DOCTYPE html>\n"
                                            "<html>\n"
                                            "<head>\n"
                                            "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n"
                                            "</head>\n"
                                            "<body>\n"
                                            "<p>这只是一个测试用接口而已, 这里没有你想要的数据.</p>\n"
                                            "</body>\n"
                                            "</html>", MIME(Text, Html));
    };

    server.AddAnalyzeHandle("test", "测试用的端口，无实际功能",func);

    server.Start();

    return 0;
}